<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
  
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:ui="http://java.sun.com/jsf/facelets"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"> 

<h:head>
	<title>Cadastrar produto</title>
</h:head>

<h:body> 
	<fieldset>
		<legend style="FONT-FAMILY: 'Calibri'; FONT-SIZE: small;">Cadastrar produto</legend>
		<h:form style="FONT-FAMILY: 'Calibri'; FONT-SIZE: small;">
		
			<h:panelGrid columns="2">
				<h:outputLabel value="Nome do produto: " />
				<h:inputText value="#{productBean.product.name}" label="Nome do produto" required="true">
				</h:inputText>
				
				<h:outputLabel value="Categoria: " />
				<h:selectOneMenu value="#{productBean.product.category.id}" label="Categoria" required="true">
					<f:selectItems value="#{categoryBean.optionValuesCategories}" />
				</h:selectOneMenu>
				
				<h:outputLabel value="Quantidade: " />
				<h:inputText value="#{productBean.product.unit}" label="Quantidade" required="true">
				</h:inputText>
				
				<h:outputLabel value="Preço: " />
				<h:inputText value="#{productBean.product.price}" label="Preço" required="true">
				</h:inputText>
				
				<h:outputLabel value="Descrição: " />
				<h:inputText value="#{productBean.product.description}" label="Descrição" required="true" >
				</h:inputText>
				
				<h:outputLabel value="" />
				<h:commandButton type="submit" action="#{productBean.saveProduct()}" value="Enviar" />
			</h:panelGrid>
			<h:messages errorStyle="color: red; border:1" style="color: red; border:1"/>
		</h:form>
		
		<h:form style="FONT-FAMILY: 'Calibri'; FONT-SIZE: small;">
			<div style="margin-top: 20px">
				<h:commandLink value="Listar produtos" action="#{productBean.listProducts()}"/> /
				<h:commandLink value="Pagina de controle" action="#{productBean.controlPanel()}"/>
			</div>
		</h:form> 
	</fieldset>
</h:body> 
</html>
